package com.cw.base.jeeyc.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cw.base.common.model.dto.response.CommonRespDto;
import com.cw.base.jeeyc.biz.intf.DeployDictItemQueryBiz;
import com.cw.base.jeeyc.deploy.dto.DeployDictItemDto;
import com.cw.base.jeeyc.deploy.dto.response.BatchDictItemQueryRespDto;
import com.cw.base.jeeyc.deploy.intf.DeployDictItemQueryApi;

import lombok.extern.slf4j.Slf4j;

/**
 * 数据字典项
 *
 * @author chenw
 * @date 2019-08-26 21:21:57
 */
@RestController
@RequestMapping("/v1/deployDictItemQuery")
@Slf4j
public class DeployDictItemQueryApiImpl implements DeployDictItemQueryApi {
    @Autowired
    private DeployDictItemQueryBiz deployDictItemBiz;

    /**
     * 分页查询数据字典项
     *
     * @param request 条件
     * @return PageInfo<DeployDictItemDto>
     */
    @Override
    public CommonRespDto<Page<DeployDictItemDto>> selectPage(@RequestBody DeployDictItemDto request) {
        Page<DeployDictItemDto> pageInfo = deployDictItemBiz.selectPage(request);
        return CommonRespDto.<Page<DeployDictItemDto>>builder().data(pageInfo)
            .build();
    }

    /**
     * 查询数据字典项详情信息
     *
     * @param request 条件
     * @return DeployDictItemDto
     */
    @Override
    public CommonRespDto<DeployDictItemDto> queryDetail(@RequestBody DeployDictItemDto request) {
        DeployDictItemDto deployDictItemDto = deployDictItemBiz.queryDetail(request);
        return CommonRespDto.<DeployDictItemDto>builder().data(deployDictItemDto)
            .build();
    }

    /**
     * 批量查询字典项列表
     *
     * @param request
     * @return
     */
    @Override
    public CommonRespDto<BatchDictItemQueryRespDto> batchQueryDictItem(
        @RequestBody DeployDictItemDto request) {
        log.info("批量查询字典项列表");
        return CommonRespDto.<BatchDictItemQueryRespDto>builder().data(deployDictItemBiz.batchQueryDictItem(request))
            .build();
    }
}
